/*
 * Copyright (c) Huawei Technologies Co., Ltd. 2024-2024. All rights reserved.
 */

import { TaskDetails } from '@ohos/hvigor';
import { glob } from 'glob';

import { NativeConst } from '../../const/common-const.js';
import { TargetTaskService } from '../service/target-task-service.js';
import { OhosHapTask } from '../task/ohos-hap-task.js';

export class ProcessLibsCommonProperties extends OhosHapTask {
  protected constructor(taskService: TargetTaskService, taskDetails: TaskDetails) {
    super(taskService, taskDetails);
  }

  protected get libsPattern() {
    return this.targetService.getBuildOption().nativeLib?.collectAllLibs ? NativeConst.LIBRARY_ALL_FILE_PATTERN : NativeConst.LIBRARY_FILE_PATTERN;
  }

  protected getLibsInfo(libsPath: string): string[] {
    return glob.sync(this.libsPattern, { cwd: libsPath });
  }

  protected doTaskAction(): void {
    // no task
  }

  initTaskDepends(): void {
    // no depends
  }
}
